package controller;

import Operation.*;
import java.sql.SQLException;

/**
 * 账户管理类
 *  - 对数据库账户表的增删改查操作
 */
public class AccountController {

    //操作功能数组
    protected IOperation[] iOperations;

    public AccountController(){
        iOperations = new IOperation[]{
                null,
                new SearchByKeywordIOperation(),
                new SearchAllOperationIOperation(),
                new AddNewAccountIOperation(),
                new ModifyAccountIOperation(),
                new DeleteAccountIOperation(),
        };
    }

    //执行指定选项功能
    public void operate(int option){
        try {
            iOperations[option].operate();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

}
